package net.ixion.portal.module.base;

import java.util.LinkedHashMap;

import javax.persistence.Inheritance;

import net.ixion.portal.utils.result.OperationState;
import net.ixion.portal.utils.result.Result;

import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.Encoding;

/**
 * 
 * @author 贵源 每个模块只需要继承此模块，配置@At和@Fail即可
 * @Fail 建议直接放到统一的处理view进行处理 @Fail("jsp:jsp.exception.exception")
 */
@Encoding(input = "UTF-8", output = "UTF-8")
@IocBean
@Inheritance
public class BaseModule {
	public Result result = new Result(OperationState.DEFAULT,
			new LinkedHashMap<String, Object>(), "");
	public LinkedHashMap<String, Object> data = new LinkedHashMap<String, Object>();
	public String title;

	public BaseModule() {
		result.clear();
		data.clear();
		title = "";
	}

	protected Result fillResult() {
		result.setData(data);
		result.setTitle(title);
		return result;
	}

	protected void clear() {
		result.clear();
		data.clear();
		title = "";
	}
}
